package Multithreading.Wait_and_Notify002;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * ClassName:Cook
 * Package:Multithreading.Wait_and_Notify002
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/3/5-22:38
 * @Version:v1.0
 */
public class Cook extends Thread {
    ArrayBlockingQueue<String> queue;

    public Cook(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            //不断把面条放到阻塞队列当中
            try {
                queue.put("面条");
                System.out.println("厨师放了一碗面条");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
